<?php
// 校验用户名或者密码是否正确
$link = mysqli_connect("localhost","root","root","2113");


// print_r($_POST);
$username = $_POST['username'];
$pwd = $_POST['pwd'];
$arr = [];
$sql = "SELECT * FROM users WHERE username='$username' AND pwd='$pwd'";
$res =  mysqli_query($link,$sql);
$one = mysqli_fetch_assoc($res);

if(!empty($one)){
	$arr['status'] = 1;
	$arr['info'] = "用户名密码正确";
	$arr['data'] = $one;
}else{
	$arr['status'] = 0;
	$arr['info'] = "用户名或者密码错误";
}




// if($username=="root" && $pwd=="root"){
// 	$arr['status'] = 1;
// 	$arr['info'] = "用户名密码正确";
// 	$arr['data'] = array("username"=>$username,"id"=>2);
// }else{
// 	$arr['status'] = 0;
// 	$arr['info'] = "用户名或者密码错误";
// }
echo json_encode($arr);

?>